<%@page import="java.util.List"%>
<%@page import="java.io.Reader"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%request.setCharacterEncoding("utf-8"); %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
		String driver = "oracle.jdbc.driver.OracleDriver";
		String url = "jdbc:oracle:thin:@127.0.0.1:1521:xe";
		String db_user = "semi";
		String db_pwd = "semi";
		Connection con; 
		PreparedStatement psmt;
		ResultSet rs;
		int cnt1=0;
		try {
			con = DriverManager.getConnection(url, db_user, db_pwd);
			System.out.println("DB접속 성공");
			
			String sql3 ="select content from test where no=2";
			psmt = con.prepareStatement(sql3);
			rs = psmt.executeQuery();
			StringBuilder sb = null;
			if(rs.next()){
				Reader rd  = rs.getCharacterStream("content");
				sb = new StringBuilder();
				char[] buff = new char[1024];
				int read=0;
				while((read = rd.read(buff,0,1024))!=-1){
					sb.append(buff,0,read);
				}
			}
			rs.close();
			psmt.close();
			con.close();
			System.out.println("죄회끝");	
			%>
			<textarea rows="40" cols="100" name="content" id="textAreaContent"><%=sb.toString() %></textarea>
			<div style="width: 700px; height: 500px; overflow: auto; border: 3px solid red"><%=sb.toString() %></div>
			<%=sb.toString() %>
			<%
		} catch (Exception e) {
			e.printStackTrace();
		}
	%>
</body>
</html>